Home

Operator Usage

Name

swrite

Description

swrite(positions-sp, destination-sp) input-seq
for each index in positions-sp, overwrite the corresponding element in the input sequence with destination-sp
index values start from 1, not 0
negative values are also valid, so -1 is last element, -2 is second last element, etc
the order of the indices in positions-sp do not matter
if a ket in positions-sp is out of range, or not a number, ignore that ket


Examples

-- define a toy sequence:
the |seq> => ssplit[" "] |alpha beta gamma delta epsilon zeta>

-- now see what we have:
the |seq>
    |alpha> . |beta> . |gamma> . |delta> . |epsilon> . |zeta>

-- overwrite the second and last element of the sequence with the letter Z:
swrite(|2> + |-1>, |Z>) the |seq>
    |alpha> . |Z> . |gamma> . |delta> . |epsilon> . |Z>


See also

Operator type

function 2